import 'package:flutter/cupertino.dart';

typedef void LeftButtonClick();
typedef void RightButtonClick();

// ignore: must_be_immutable
class ContentBtn2Dialog extends StatefulWidget {
  LeftButtonClick leftClick;
  RightButtonClick rightClick;

  String title;

  String content;
  String leftContent;
  String rightContent;

  ContentBtn2Dialog(this.title, this.content, this.leftClick, this.rightClick,
      this.leftContent, this.rightContent);

  @override
  _ContentBtn2Dialog createState() => _ContentBtn2Dialog();
}

class _ContentBtn2Dialog extends State<ContentBtn2Dialog> {
  @override
  Widget build(BuildContext context) {
    return CupertinoAlertDialog(
      title: Text(widget.title),
      content: Column(
        children: <Widget>[
          SizedBox(
            height: 10,
          ),
          Align(
            child: Text(widget.content),
            alignment: Alignment(0, 0),
          ),
        ],
      ),
      actions: <Widget>[
        CupertinoDialogAction(
          child: Text(widget.leftContent),
          onPressed: () {
            Navigator.pop(context);
            widget.leftClick();
          },
        ),
        CupertinoDialogAction(
          child: Text(widget.rightContent),
          onPressed: () {
            Navigator.pop(context);
            widget.rightClick();
          },
        ),
      ],
    );
  }
}
